<?PHP

$query = "
SELECT * FROM `wcorp` WHERE 1 ".mysql_where()." ORDER BY transactionDateTime DESC LIMIT ".mysql_real_escape_string($start).",".mysql_real_escape_string($limit)."
";

$query2 = "
SELECT SUM(price*quantity) AS price, SUM(quantity) AS quantity, MIN(price) AS minimum, MAX(price) AS maximum FROM `".$settings['corptransactionstable']."` WHERE `typeID` = '".mysql_real_escape_string($_GET['typeID'])."'
";

$query3 = "
SELECT SUM(price*quantity) AS price, SUM(quantity) AS quantity, MIN(price) AS minimum, MAX(price) AS maximum FROM `".$settings['corptransactionstable']."` WHERE `typeID` = '".mysql_real_escape_string($_GET['typeID'])."' AND `transactionDateTime` >= DATE_SUB(CURDATE(), INTERVAL 1 MONTH)
";

$query4 = "
SELECT SUM(price*quantity) AS price, SUM(quantity) AS quantity, MIN(price) AS minimum, MAX(price) AS maximum FROM `".$settings['corptransactionstable']."` WHERE `typeID` = '".mysql_real_escape_string($_GET['typeID'])."' AND `transactionDateTime` >= DATE_SUB(CURDATE(), INTERVAL 7 DAY)
";

$query5 = "
SELECT * FROM `jcorp` ".mysql_jwhere()." ORDER BY date DESC LIMIT ".mysql_real_escape_string($start).",".mysql_real_escape_string($limit)."
";

$query10 = "
SELECT `price`,`transactionDateTime`,`quantity` FROM `".$settings[mysql_real_escape_string($_GET['wallet']).'transactionstable']."` WHERE `typeID` = '".mysql_escape_string($_GET['typeID'])."' ORDER BY `transactionDateTime` DESC LIMIT 50
";

$query11 = "
SELECT * FROM `wallet` WHERE 1 ".mysql_where()." ORDER BY transactionDateTime DESC LIMIT ".mysql_real_escape_string($start).",".mysql_real_escape_string($limit)."
";

$query12 = "
SELECT SUM(price*quantity) AS price, SUM(quantity) AS quantity, MIN(price) AS minimum, MAX(price) AS maximum FROM `".$settings['personaltransactionstable']."` WHERE `typeID` = '".mysql_real_escape_string($_GET['typeID'])."'
";

$query13 = "
SELECT SUM(price*quantity) AS price, SUM(quantity) AS quantity, MIN(price) AS minimum, MAX(price) AS maximum FROM `".$settings['personaltransactionstable']."` WHERE `typeID` = '".mysql_real_escape_string($_GET['typeID'])."' AND `transactionDateTime` >= DATE_SUB(CURDATE(), INTERVAL 1 MONTH)
";

$query14 = "
SELECT SUM(price*quantity) AS price, SUM(quantity) AS quantity, MIN(price) AS minimum, MAX(price) AS maximum FROM `".$settings['personaltransactionstable']."` WHERE `typeID` = '".mysql_real_escape_string($_GET['typeID'])."' AND `transactionDateTime` >= DATE_SUB(CURDATE(), INTERVAL 7 DAY)
";

$query15 = "
SELECT * FROM `journal` ".mysql_jwhere()." ORDER BY date DESC LIMIT ".mysql_real_escape_string($start).",".mysql_real_escape_string($limit)."
";

$query16 = "
SELECT `price`,`transactionDateTime`,`quantity` FROM `".$settings[mysql_real_escape_string($_GET['wallet']).'transactionstable']."` WHERE `typeID` = '".mysql_escape_string($_GET['typeID'])."' AND `transactionDateTime` >= DATE_SUB(CURDATE(), INTERVAL 7 DAY) ORDER BY `transactionDateTime` DESC
";

$query17 = "
SELECT `price`,`transactionDateTime`,`quantity` FROM `".$settings[mysql_real_escape_string($_GET['wallet']).'transactionstable']."` WHERE `typeID` = '".mysql_escape_string($_GET['typeID'])."' AND `transactionDateTime` >= DATE_SUB(CURDATE(), INTERVAL 1 MONTH) ORDER BY `transactionDateTime` DESC
";

$query18 = "
SELECT SUM(price*quantity) AS price, SUM(quantity) AS quantity, MIN(price) AS minimum, MAX(price) AS maximum FROM `".$settings[mysql_real_escape_string($_GET['wallet']).'transactionstable']."` WHERE `typeID` = '".mysql_real_escape_string($_GET['typeID'])."'
";

$query19 = "
SELECT SUM(price*quantity) AS price, SUM(quantity) AS quantity, MIN(price) AS minimum, MAX(price) AS maximum FROM `".$settings[mysql_real_escape_string($_GET['wallet']).'transactionstable']."` WHERE `typeID` = '".mysql_real_escape_string($_GET['typeID'])."' AND `transactionDateTime` >= DATE_SUB(CURDATE(), INTERVAL 1 MONTH)
";

$query20 = "
SELECT SUM(price*quantity) AS price, SUM(quantity) AS quantity, MIN(price) AS minimum, MAX(price) AS maximum FROM `".$settings[mysql_real_escape_string($_GET['wallet']).'transactionstable']."` WHERE `typeID` = '".mysql_real_escape_string($_GET['typeID'])."' AND `transactionDateTime` >= DATE_SUB(CURDATE(), INTERVAL 7 DAY)
";
?>